package homework;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LENOVO
 * Date: 2024-08-08
 * Time: 20:57
 */
class MinStack1 {
    Stack<Integer> stack = new Stack<>();
    Stack<Integer> minstack = new Stack<>();
    public MinStack1() {

    }

    public void push(int val) {
        if(stack.empty()){
            stack.push(val);
            minstack.push(val);
            return;
        }
        if(val <= minstack.peek()){
            minstack.push(val);
        }else{
            stack.push(val);
        }
    }

    public void pop() {
        if(stack.empty()){
            return;
        }
        if(minstack.peek() == stack.pop()){
            minstack.pop();
        }
        minstack.peek().equals()

    }

    public int top() {
        if(stack.empty()){
            return - 1;
        }
        return stack.peek();
    }

    public int getMin() {
        if(minstack.empty()){
            return - 1;
        }
        return minstack.peek();
    }
}
public class MinStack {
    public static void main(String[] args) {
        MinStack1 minStack1 = new MinStack1();
        minStack1.push(-2);
        minStack1.push(0);
        minStack1.push(-1);
        //"MinStack","push","push","push","getMin","pop","top","getMin"
        System.out.println(minStack1.getMin());
        minStack1.pop();
        System.out.println(minStack1.top());
        System.out.println(minStack1.getMin());
    }
}
